package com.demohomework.homeworkdemo.service.impl;

import com.demohomework.homeworkdemo.mapper.AssCorrectMapper;
import com.demohomework.homeworkdemo.pojo.AssCorrect;
import com.demohomework.homeworkdemo.service.AssCorrectService;
import com.demohomework.homeworkdemo.util.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AssCorrectServiceImpl implements AssCorrectService {
    @Autowired
    private AssCorrectMapper assCorrectMapper;

    @Override
    public List<AssCorrect> list() {
        Map<String, Object> map = ThreadLocalUtil.get();
        Integer id = (Integer) map.get("id");
        return assCorrectMapper.list(id);
    }

    @Override
    public void update(AssCorrect assCorrect) {
        assCorrectMapper.update(assCorrect);
    }

    @Override
    public void add(AssCorrect assCorrect) {
        assCorrectMapper.add(assCorrect);
    }

    @Override
    public boolean existsByAssIdAndStuId(int assId, int stuId) {
        return assCorrectMapper.existsByAssIdAndStuId(assId, stuId);
    }
}
